package per.hx.bs.service;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.*;
import per.hx.bs.entity.WxUserDO;

/**
 * @author HuXing
 * @date 2018/5/10  17:01
 */
@Primary
@FeignClient(value = "Huxingbs-Wx-Service")
public interface WxUserService {

    /**
     * 获取微信用户信息
     *
     * @param id id
     * @return 微信用户信息
     */
    @GetMapping(value = "/wxUser/{id}")
    WxUserDO get(@PathVariable("id") String id);

    /**
     * 获取微信用户信息
     *
     * @param openId id
     * @return 微信用户信息
     */
    @GetMapping(value = "/wxUser/id/{openId}")
    WxUserDO getByOpenId(@PathVariable("openId") String openId);

    /**
     * 插入信息
     *
     * @param wxUserDO 用户信息
     * @return 结果
     */
    @PostMapping(value = "/wxUser")
    Integer insert(@RequestBody WxUserDO wxUserDO);

    /***
     *更新用户信息
     * @param wxUserDO 用户信息
     * @return 结果
     */
    @PutMapping(value = "/wxUser")
    Integer update(@RequestBody WxUserDO wxUserDO);

    /**
     * 删除信息
     *
     * @param id 表id
     * @return 结果
     */
    @DeleteMapping(value = "/wxUser/{id}")
    Integer delete(@PathVariable("id") String id);

    /**
     * 删除信息
     *
     * @param openId 微信id
     * @return 结果
     */
    @DeleteMapping(value = "/wxUser/id/{openId}")
    Integer deleteByOpenId(@PathVariable("openId") String openId);

}
